﻿<%@ Page Title="" Language="C#" ClientIDMode=Static MasterPageFile="~/User/User.Master" AutoEventWireup="true" CodeBehind="MenuMgr.aspx.cs" Inherits="CoolERP_Web.User.MenuMgr" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="../Scripts/lhgdialog/lhgcore.min.js" type="text/javascript"></script>
<script src="../Scripts/lhgdialog/lhgdialog.js" type="text/javascript"></script>
<script type="text/javascript">
    var dg;
    function showEdit(id) {
        dg = new J.dialog({ id: 'select', title: '修改菜单', page: 'MenuEdit.aspx?id=' + id, iconTitle: false, cover: true, btnBar: false, rang: true, autoSize: true, width: 450, height: 350 });
        dg.ShowDialog();
    }
    function showAdd() {
        dg = new J.dialog({ id: 'select', title: '新增菜单', page: 'MenuEdit.aspx', iconTitle: false, cover: true, btnBar: false, rang: true, autoSize: true, width: 450, height: 350 });
        dg.ShowDialog();
    }
    function delMenus() {
        if (!isCheck('tbList')) return;
        var allcheckboxs = $("input[@type=checkbox][name=chkSel][checked]");
        var ids = "";
        for (var i = 0; i < allcheckboxs.length; i++)
            ids += $(allcheckboxs[i]).attr("value") + ",";
        if (ids != "")
            ids = ids.substr(0, ids.length - 1);
        $("#hidDelIds").val(ids);
        document.getElementById("btnDelete").click();
    }
    function showChild(obj, id) {
        if ($(obj).attr("title") == "展开") {
            $(obj).closest("tr").siblings(".tr" + id).each(function () {
                $(this).show();
            });
            $(obj).attr("title", "折叠");
            $(obj).attr("src", "../Images/Icon/-.jpg");
        }
        else {
            $(obj).closest("tr").siblings(".tr" + id).each(function () {
                $(this).hide();
            });
            $(obj).attr("title", "展开");
            $(obj).attr("src", "../Images/Icon/+.jpg");
        }
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td class=tbHead_L></td>
        <td class=tbHead_M><div><b>菜单管理</b></div></td>
        <td class=tbHead_R></td>
    </tr>
    <tr>
        <td class=tbBody_L></td>
        <td class=tbBody_M>
            <ul class=tags style="width:95%;">
                <li class=liTitle><div>菜单管理</div></li>
                <li class=liRight><img src="../Images/Common/btn_add0.png" onclick="javascript:showAdd()" style="cursor:pointer" />
                <img src="../Images/Common/btn_del0.png" onclick="javascript:delMenus()" style="cursor:pointer" /></li>
            </ul>
            <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
            <HeaderTemplate>
            <table class="grvCSS" cellspacing="0" rules="all" border="1" id="tbList" style="width:95%;border-collapse:collapse;">
		        <tr>
			        <th width=60px><label><input type="checkbox" onclick="checkAll('tbList',this)" />全选</label></th><th>编码</th><th>名称</th><th>链接地址</th><th>排序</th><th>状态</th><th>修改</th>
		        </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td><input type=checkbox id="chkSel" name="chkSel" value='<%# Eval("Id") %>' /></td>
                    <td style="text-align:left; padding-left:15px"><img src="../Images/Icon/+.jpg" onclick="javascript:showChild(this,'<%# Eval("Id") %>')" style="cursor:pointer" title="展开" />
                    <%# Eval("Name")%><td><%# Eval("Code")%></td></td><td><%# Eval("Url")%></td><td><%# Eval("Sort")%></td>
                    <td><%# Eval("Enabled") != null && Convert.ToInt32(Eval("Enabled").ToString()) == 1 ? "启用" : "禁用" %></td>
                    <td><img src="../Images/Common/btn_edit0.png" onclick="javascript:showEdit('<%# Eval("Id") %>')" style="cursor:pointer" /></td>
                </tr>
                <asp:Repeater ID="repChild" runat="server">
                <ItemTemplate>
                <tr class='tr<%# Eval("ParentId")%>' style="display:none">
                    <td><input type=checkbox id="chkSel" name="chkSel" value='<%# Eval("Id") %>' /></td>
                    <td style="text-align:left; padding-left:50px"><%# Eval("Name")%></td><td><%# Eval("Code")%></td><td><%# Eval("Url")%></td><td><%# Eval("Sort")%></td>
                    <td><%# Eval("Enabled") != null && Convert.ToInt32(Eval("Enabled").ToString()) == 1 ? "启用" : "禁用" %></td>
                    <td><img src="../Images/Common/btn_edit0.png" onclick="javascript:showEdit('<%# Eval("Id") %>')" style="cursor:pointer" /></td>
                </tr>
                </ItemTemplate>
                </asp:Repeater>
            </ItemTemplate>
            <FooterTemplate></table></FooterTemplate>
            </asp:Repeater>
            <asp:Panel ID="panMsg" runat="server" ClientIDMode=Static CssClass="msg24_attention" Visible=false>无相关数据</asp:Panel>
        </td>
        <td class=tbBody_R></td>
    </tr>
    <tr>
        <td class=tbFoot_L></td>
        <td class=tbFoot_M></td>
        <td class=tbFoot_R></td>
    </tr>
</table>
<asp:Button ID="btnDelete" runat="server" OnClick="btnDelete_Click" style="display:none" />
<asp:HiddenField ID="hidDelIds" runat="server" />
</asp:Content>
